/**
 */
package org.mro.grib.model.files.secondEdition.products.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.mro.grib.model.files.secondEdition.products.ProductDefinitionTemplate45;
import org.mro.grib.model.files.secondEdition.products.ProductsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Product Definition Template45</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getForecastProbabilityNumber <em>Forecast Probability Number</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getTotalNumberOfForecastProbabilities <em>Total Number Of Forecast Probabilities</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getProbabilityType <em>Probability Type</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getScaleFactorOfLowerLimit <em>Scale Factor Of Lower Limit</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getScaledValueOfLowerLimit <em>Scaled Value Of Lower Limit</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getScaleFactorOfUpperLimit <em>Scale Factor Of Upper Limit</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate45Impl#getScaledValueOfUpperLimit <em>Scaled Value Of Upper Limit</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProductDefinitionTemplate45Impl extends ProductDefinitionTemplate40Impl implements ProductDefinitionTemplate45 {
	/**
	 * The default value of the '{@link #getForecastProbabilityNumber() <em>Forecast Probability Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getForecastProbabilityNumber()
	 * @generated
	 * @ordered
	 */
	protected static final byte FORECAST_PROBABILITY_NUMBER_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getForecastProbabilityNumber() <em>Forecast Probability Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getForecastProbabilityNumber()
	 * @generated
	 * @ordered
	 */
	protected byte forecastProbabilityNumber = FORECAST_PROBABILITY_NUMBER_EDEFAULT;

	/**
	 * The default value of the '{@link #getTotalNumberOfForecastProbabilities() <em>Total Number Of Forecast Probabilities</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTotalNumberOfForecastProbabilities()
	 * @generated
	 * @ordered
	 */
	protected static final byte TOTAL_NUMBER_OF_FORECAST_PROBABILITIES_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getTotalNumberOfForecastProbabilities() <em>Total Number Of Forecast Probabilities</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTotalNumberOfForecastProbabilities()
	 * @generated
	 * @ordered
	 */
	protected byte totalNumberOfForecastProbabilities = TOTAL_NUMBER_OF_FORECAST_PROBABILITIES_EDEFAULT;

	/**
	 * The default value of the '{@link #getProbabilityType() <em>Probability Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProbabilityType()
	 * @generated
	 * @ordered
	 */
	protected static final byte PROBABILITY_TYPE_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getProbabilityType() <em>Probability Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProbabilityType()
	 * @generated
	 * @ordered
	 */
	protected byte probabilityType = PROBABILITY_TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getScaleFactorOfLowerLimit() <em>Scale Factor Of Lower Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaleFactorOfLowerLimit()
	 * @generated
	 * @ordered
	 */
	protected static final byte SCALE_FACTOR_OF_LOWER_LIMIT_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getScaleFactorOfLowerLimit() <em>Scale Factor Of Lower Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaleFactorOfLowerLimit()
	 * @generated
	 * @ordered
	 */
	protected byte scaleFactorOfLowerLimit = SCALE_FACTOR_OF_LOWER_LIMIT_EDEFAULT;

	/**
	 * The default value of the '{@link #getScaledValueOfLowerLimit() <em>Scaled Value Of Lower Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaledValueOfLowerLimit()
	 * @generated
	 * @ordered
	 */
	protected static final int SCALED_VALUE_OF_LOWER_LIMIT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getScaledValueOfLowerLimit() <em>Scaled Value Of Lower Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaledValueOfLowerLimit()
	 * @generated
	 * @ordered
	 */
	protected int scaledValueOfLowerLimit = SCALED_VALUE_OF_LOWER_LIMIT_EDEFAULT;

	/**
	 * The default value of the '{@link #getScaleFactorOfUpperLimit() <em>Scale Factor Of Upper Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaleFactorOfUpperLimit()
	 * @generated
	 * @ordered
	 */
	protected static final byte SCALE_FACTOR_OF_UPPER_LIMIT_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getScaleFactorOfUpperLimit() <em>Scale Factor Of Upper Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaleFactorOfUpperLimit()
	 * @generated
	 * @ordered
	 */
	protected byte scaleFactorOfUpperLimit = SCALE_FACTOR_OF_UPPER_LIMIT_EDEFAULT;

	/**
	 * The default value of the '{@link #getScaledValueOfUpperLimit() <em>Scaled Value Of Upper Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaledValueOfUpperLimit()
	 * @generated
	 * @ordered
	 */
	protected static final int SCALED_VALUE_OF_UPPER_LIMIT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getScaledValueOfUpperLimit() <em>Scaled Value Of Upper Limit</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScaledValueOfUpperLimit()
	 * @generated
	 * @ordered
	 */
	protected int scaledValueOfUpperLimit = SCALED_VALUE_OF_UPPER_LIMIT_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProductDefinitionTemplate45Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductsPackage.Literals.PRODUCT_DEFINITION_TEMPLATE45;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getForecastProbabilityNumber() {
		return forecastProbabilityNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setForecastProbabilityNumber(byte newForecastProbabilityNumber) {
		byte oldForecastProbabilityNumber = forecastProbabilityNumber;
		forecastProbabilityNumber = newForecastProbabilityNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__FORECAST_PROBABILITY_NUMBER, oldForecastProbabilityNumber, forecastProbabilityNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getTotalNumberOfForecastProbabilities() {
		return totalNumberOfForecastProbabilities;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTotalNumberOfForecastProbabilities(byte newTotalNumberOfForecastProbabilities) {
		byte oldTotalNumberOfForecastProbabilities = totalNumberOfForecastProbabilities;
		totalNumberOfForecastProbabilities = newTotalNumberOfForecastProbabilities;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__TOTAL_NUMBER_OF_FORECAST_PROBABILITIES, oldTotalNumberOfForecastProbabilities, totalNumberOfForecastProbabilities));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getProbabilityType() {
		return probabilityType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProbabilityType(byte newProbabilityType) {
		byte oldProbabilityType = probabilityType;
		probabilityType = newProbabilityType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__PROBABILITY_TYPE, oldProbabilityType, probabilityType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getScaleFactorOfLowerLimit() {
		return scaleFactorOfLowerLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScaleFactorOfLowerLimit(byte newScaleFactorOfLowerLimit) {
		byte oldScaleFactorOfLowerLimit = scaleFactorOfLowerLimit;
		scaleFactorOfLowerLimit = newScaleFactorOfLowerLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_LOWER_LIMIT, oldScaleFactorOfLowerLimit, scaleFactorOfLowerLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getScaledValueOfLowerLimit() {
		return scaledValueOfLowerLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScaledValueOfLowerLimit(int newScaledValueOfLowerLimit) {
		int oldScaledValueOfLowerLimit = scaledValueOfLowerLimit;
		scaledValueOfLowerLimit = newScaledValueOfLowerLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_LOWER_LIMIT, oldScaledValueOfLowerLimit, scaledValueOfLowerLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getScaleFactorOfUpperLimit() {
		return scaleFactorOfUpperLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScaleFactorOfUpperLimit(byte newScaleFactorOfUpperLimit) {
		byte oldScaleFactorOfUpperLimit = scaleFactorOfUpperLimit;
		scaleFactorOfUpperLimit = newScaleFactorOfUpperLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_UPPER_LIMIT, oldScaleFactorOfUpperLimit, scaleFactorOfUpperLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getScaledValueOfUpperLimit() {
		return scaledValueOfUpperLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScaledValueOfUpperLimit(int newScaledValueOfUpperLimit) {
		int oldScaledValueOfUpperLimit = scaledValueOfUpperLimit;
		scaledValueOfUpperLimit = newScaledValueOfUpperLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_UPPER_LIMIT, oldScaledValueOfUpperLimit, scaledValueOfUpperLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__FORECAST_PROBABILITY_NUMBER:
				return getForecastProbabilityNumber();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__TOTAL_NUMBER_OF_FORECAST_PROBABILITIES:
				return getTotalNumberOfForecastProbabilities();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__PROBABILITY_TYPE:
				return getProbabilityType();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_LOWER_LIMIT:
				return getScaleFactorOfLowerLimit();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_LOWER_LIMIT:
				return getScaledValueOfLowerLimit();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_UPPER_LIMIT:
				return getScaleFactorOfUpperLimit();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_UPPER_LIMIT:
				return getScaledValueOfUpperLimit();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__FORECAST_PROBABILITY_NUMBER:
				setForecastProbabilityNumber((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__TOTAL_NUMBER_OF_FORECAST_PROBABILITIES:
				setTotalNumberOfForecastProbabilities((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__PROBABILITY_TYPE:
				setProbabilityType((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_LOWER_LIMIT:
				setScaleFactorOfLowerLimit((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_LOWER_LIMIT:
				setScaledValueOfLowerLimit((Integer)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_UPPER_LIMIT:
				setScaleFactorOfUpperLimit((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_UPPER_LIMIT:
				setScaledValueOfUpperLimit((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__FORECAST_PROBABILITY_NUMBER:
				setForecastProbabilityNumber(FORECAST_PROBABILITY_NUMBER_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__TOTAL_NUMBER_OF_FORECAST_PROBABILITIES:
				setTotalNumberOfForecastProbabilities(TOTAL_NUMBER_OF_FORECAST_PROBABILITIES_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__PROBABILITY_TYPE:
				setProbabilityType(PROBABILITY_TYPE_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_LOWER_LIMIT:
				setScaleFactorOfLowerLimit(SCALE_FACTOR_OF_LOWER_LIMIT_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_LOWER_LIMIT:
				setScaledValueOfLowerLimit(SCALED_VALUE_OF_LOWER_LIMIT_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_UPPER_LIMIT:
				setScaleFactorOfUpperLimit(SCALE_FACTOR_OF_UPPER_LIMIT_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_UPPER_LIMIT:
				setScaledValueOfUpperLimit(SCALED_VALUE_OF_UPPER_LIMIT_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__FORECAST_PROBABILITY_NUMBER:
				return forecastProbabilityNumber != FORECAST_PROBABILITY_NUMBER_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__TOTAL_NUMBER_OF_FORECAST_PROBABILITIES:
				return totalNumberOfForecastProbabilities != TOTAL_NUMBER_OF_FORECAST_PROBABILITIES_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__PROBABILITY_TYPE:
				return probabilityType != PROBABILITY_TYPE_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_LOWER_LIMIT:
				return scaleFactorOfLowerLimit != SCALE_FACTOR_OF_LOWER_LIMIT_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_LOWER_LIMIT:
				return scaledValueOfLowerLimit != SCALED_VALUE_OF_LOWER_LIMIT_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALE_FACTOR_OF_UPPER_LIMIT:
				return scaleFactorOfUpperLimit != SCALE_FACTOR_OF_UPPER_LIMIT_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE45__SCALED_VALUE_OF_UPPER_LIMIT:
				return scaledValueOfUpperLimit != SCALED_VALUE_OF_UPPER_LIMIT_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (forecastProbabilityNumber: "); //$NON-NLS-1$
		result.append(forecastProbabilityNumber);
		result.append(", totalNumberOfForecastProbabilities: "); //$NON-NLS-1$
		result.append(totalNumberOfForecastProbabilities);
		result.append(", probabilityType: "); //$NON-NLS-1$
		result.append(probabilityType);
		result.append(", scaleFactorOfLowerLimit: "); //$NON-NLS-1$
		result.append(scaleFactorOfLowerLimit);
		result.append(", scaledValueOfLowerLimit: "); //$NON-NLS-1$
		result.append(scaledValueOfLowerLimit);
		result.append(", scaleFactorOfUpperLimit: "); //$NON-NLS-1$
		result.append(scaleFactorOfUpperLimit);
		result.append(", scaledValueOfUpperLimit: "); //$NON-NLS-1$
		result.append(scaledValueOfUpperLimit);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.products.IProductDefinition#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		super.initialise(buffer);
		forecastProbabilityNumber = buffer.get();
		totalNumberOfForecastProbabilities = buffer.get();
		probabilityType = buffer.get();
		scaleFactorOfLowerLimit = buffer.get();
		scaledValueOfLowerLimit = buffer.getInt();
		scaleFactorOfUpperLimit = buffer.get();
		scaledValueOfUpperLimit = buffer.getInt();
	}

} //ProductDefinitionTemplate45Impl
